ALTER TABLE `<?php echo $table_from ?>`
ADD CONSTRAINT `<?php echo $table_from ?>_<?php echo $field ?>_fk` FOREIGN KEY (`<?php echo $field ?>`) REFERENCES `<?php echo $table_to ?>` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE ;